package com.sleepsocial.api;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sleepsocial.api.beans.ApiResponse;
import com.sleepsocial.api.beans.SimpleApiResponse;
import com.sleepsocial.api.error.ApiError;

public class Api {
    public static final int    VERSION      = 1;
    public static final String API_BASE_URL = "/api/" + VERSION;

    @ExceptionHandler(Exception.class)
    public @ResponseBody
    ApiResponse handleException(Exception e) {
        ApiResponse response = new SimpleApiResponse();
        response.setError(new ApiError(e));
        return response;
    }

}
